// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import ElementUI from 'element-ui'
import App from './App.vue'
import router from './router'
import * as filters from './filter'
import 'src/router/handle'
import './assets/styles/common.css'
import paginate from 'components/common/paginate'
import common from './util/common'

require('es6-promise').polyfill()

// 防重复点击
Vue.directive('resetClick', {
  inserted (el, binding) {
    el.addEventListener('click', () => {
      if (!el.disabled) {
        el.disabled = true
        setTimeout(() => {
          el.disabled = false
        }, binding.value || 1000)
      }
    })
  }
})
Vue.use(ElementUI, { size: 'medium' })
Vue.component('paginate', paginate)

Vue.prototype.vueTimeFormat = common.vueTimeFormat

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
Vue.config.productionTip = false

const appVue = new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

window.$message = appVue.$message
